import React from 'react'
import { View, Text, TouchableOpacity, TouchableHighlight, Image } from 'react-native'

import SizeUtils from '../../common/SizeUtils'
import Config from '../../config'
import CommonDataListView from '../common/CommonDataListView'
import BaseItem from '../common/BaseItem'
import HeartLoveItemView from './HeartLoveItemView'
import HeartLoveRequestUsersAction from '../../actions/heart/HeartLoveRequestUsersAction'
import HeartLoveRequestRecommonedUsersAction from '../../actions/heart/HeartLoveRequestRecommonedUsersAction'
import HeartLoveSearchAction from '../../actions/heart/HeartLoveSearchAction'

export default class HeartLoveItemListView extends CommonDataListView {
  constructor(props) {
    super(props)
    this.dataType = 'hot'
  }
  _onRenderItem(data, index) {
    return <HeartLoveItemView data={data} isReport={this.props.isReport} myLoveData={this.props.myLoveData} showPopover={this.props.showPopover} />
  }
  _onPressItem(data) {}
  _chageData(key) {
    this.dataType = key
    setTimeout(() => {
      this.clear()
      this.doRefresh()
    }, 400)
  }
  _getHeader() {
    return SizeUtils.translateDesignHeightToCode(420)
  }
  _requestData(page, listView) {
    if (this.dataType == 'hot') {
      new HeartLoveRequestUsersAction().call(this, { page: page, sort_id: 2 })
    } else if (this.dataType == 'genderman') {
      let sendData = { gender: 1 }
      sendData.page = page
      new HeartLoveSearchAction().call(this, sendData)
    } else if (this.dataType == 'genderwoman') {
      let sendData = { gender: 2 }
      sendData.page = page
      new HeartLoveSearchAction().call(this, sendData)
    } else {
      new HeartLoveRequestRecommonedUsersAction().call(this, { page: page })
    }
  }
}
